<template>
  <demoBlock title="树形数据展示" padding>
    <vcu-table :columns="columns" :datas="data" bordered> </vcu-table>
  </demoBlock>
</template>

<script>
import { defineComponent, ref } from "vue";
const columns = [
  {
    title: "姓名",
    dataIndex: "name",
    key: "name",
    width: 150
  },
  {
    title: "年龄",
    dataIndex: "age",
    key: "age",
    width: '20%',
  },
  {
    title: "地址",
    dataIndex: "address",
    key: "address",
  },
  {
    title: "标签",
    key: "tags",
    dataIndex: "tags",
  },
];

const data = [
  {
    key: "1",
    name: "张三",
    age: 32,
    address: "火星",
    tags: "漂亮的",
  },
  {
    key: "2",
    name: "李四",
    age: 42,
    address: "地球",
    tags: "失败者",
    children: [
      {
        key: "2-1",
        name: "李四-1",
        age: 33,
        address: "地球",
        tags: "失败者",
      },
      {
        key: "2-2",
        name: "李四-2",
        age: 34,
        address: "地球",
        tags: "失败者",
      },
    ],
  },
  {
    key: "3",
    name: "王五",
    age: 32,
    address: "月亮",
    tags: "冰冷的",
  },
];
export default defineComponent({
  setup() {
    return {
      data,
      columns,
    };
  },
});
</script>
